/**
 * Created by 张建平 on 2024/January/24.
 */
import { ElMessage, ElMessageBox } from "element-plus";
// import funcKeys from "@/config/resources.js";

export default {
    handleRemove: (selectionKeys = [], removeCallback=Function) => {
        if (selectionKeys && selectionKeys.length === 0) {
            ElMessage({
                type: "warning",
                message: "请至少选择一记录进行删除！",
            });
        } else {
            ElMessageBox.confirm(`是否删除选择的${selectionKeys.length}条记录？删除后不可恢复!`, "确认信息", {
                type: "warning",
                distinguishCancelAndClose: true,
                confirmButtonText: "删除",
                cancelButtonText: "取消",
            })
                .then(() => {
                    removeCallback();
                })
                .catch(() => {
                    ElMessage({
                        type: "info",
                        message: "您已经取消了删除操作",
                    });
                });
        }
    }
}
